{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-07-21T03:04:48.537207Z",
     "start_time": "2025-07-21T03:04:45.880905Z"
    }
   },
   "source": [
    "import pandas as pd\n",
    "from sqlalchemy import create_engine\n",
    "\n",
    "# 连接数据库\n",
    "engine = create_engine('mysql+pymysql://root:123456@localhost/tk_reviews')\n",
    "\n",
    "# 读取数据集\n",
    "df = pd.read_csv('tiktok_google_play_reviews.csv')\n",
    "print(df.head())"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                               reviewId              userName  \\\n",
      "0  68ccaec8-1415-4301-a85e-3004679a3a83          Cassie Moore   \n",
      "1  d84cbfd3-6aa3-485c-aaf9-c5dca27dc966         Kaleb Plummer   \n",
      "2  96618aa1-31e5-4259-8649-89b75d962f00           Rylee Maher   \n",
      "3  078c0bda-598b-474e-a04e-d7cb3e6f6301  Kittykatelyn Romilly   \n",
      "4  8e68c5cd-b12a-4206-a8da-6bfdbff44ae3      Loveness Malenga   \n",
      "\n",
      "                                           userImage  \\\n",
      "0  https://play-lh.googleusercontent.com/a/ALm5wu...   \n",
      "1  https://play-lh.googleusercontent.com/a-/ACNPE...   \n",
      "2  https://play-lh.googleusercontent.com/a/ALm5wu...   \n",
      "3  https://play-lh.googleusercontent.com/a-/ACNPE...   \n",
      "4  https://play-lh.googleusercontent.com/a-/ACNPE...   \n",
      "\n",
      "                                             content  score  thumbsUpCount  \\\n",
      "0                                           No words      5              0   \n",
      "1                              Great fun app so far!      5              0   \n",
      "2  The app would get a higher rating but I litera...      1              0   \n",
      "3  I WISH I COULD GIVE THIS A 100 PERCENT RATING ...      5              0   \n",
      "4                                Pictures and record      5              0   \n",
      "\n",
      "  reviewCreatedVersion                   at replyContent repliedAt  \n",
      "0               27.1.3  2022-11-29 21:55:37          NaN       NaN  \n",
      "1                  NaN  2022-11-29 21:55:04          NaN       NaN  \n",
      "2               27.1.3  2022-11-29 21:54:48          NaN       NaN  \n",
      "3                  NaN  2022-11-29 21:54:35          NaN       NaN  \n",
      "4                  NaN  2022-11-29 21:54:21          NaN       NaN  \n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\10434\\AppData\\Local\\Temp\\ipykernel_26064\\2482345965.py:8: DtypeWarning: Columns (8,9) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  df = pd.read_csv('tiktok_google_play_reviews.csv')\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": [
    "# 检查缺失值\n",
    "print(df.isnull().sum())\n"
   ],
   "id": "f5b07af1f5af982c"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "c1ab6ffc80d68277"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "3fd3df5a1af574c8"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "b8b06a0de894223a"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "bbf84559178ffed4"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "30afa5437085e732"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "2b10e91e0adaf5d8"
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "839b34fe410da20a"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python base",
   "language": "python",
   "name": "base"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
